﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Linq;
using System.Data.Linq;
using System.Collections.Generic;
namespace Exact_Extension
{
    public partial class DebitNoteRpt : DevExpress.XtraReports.UI.XtraReport
    {

        List<ISHCMC_ListInvoiceDetail_DebitNote> ListInvoiceDetail;
        string title ="";
        public DebitNoteRpt()
        {
            InitializeComponent();
           
        }
        public void SetListInvoiceDetail(List<ISHCMC_ListInvoiceDetail_DebitNote> _ListInvoiceDetail)
        {
            ListInvoiceDetail = _ListInvoiceDetail;
                
        }
        public void SetTitle(string _title)
        {
            title = _title;
        }
        private void ProformaInv_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
           
            double Total = 0;
            
        
            this.lbPriceAPPF.Text = "-";

            this.lbDisAPPF.Text = "-";
           
            this.lbNPriceAPPF.Text = "-";
           
            this.lbTitle.Text = title;
            foreach (ISHCMC_ListInvoiceDetail_DebitNote item in ListInvoiceDetail)
            {
               
                this.lbInvoiceDebtorName.Text = item.BillingName.ToString();

                this.lbAddress1.Text = item.BillingAddr1;
                this.lbAddress2.Text = item.BillingAddr2;
                this.lbAddress3.Text = item.BillingAddr3;
                this.lbInvoiceNo.Text = item.yourref;
                if (item.Invoicedate.HasValue)
                {
                    this.lbInvoiceDate.Text = item.Invoicedate.Value.ToString("dd MMM yyyy", System.Globalization.CultureInfo.GetCultureInfo("en"));
                }
                if (item.DueDate.HasValue)
                {
                    this.lbDueDate.Text = item.DueDate.Value.ToString("dd MMM yyyy", System.Globalization.CultureInfo.GetCultureInfo("en"));
                }
                
                this.lbStudentName.Text = item.StudentName;
                this.lbGrade.Text = item.CurrentGrade;
                if (item.EnrolmentDate.HasValue)
                {
                    this.lbEnDate.Text = item.EnrolmentDate.Value.ToString("MMM, yy", System.Globalization.CultureInfo.GetCultureInfo("en"));
                }
             
                if (item.itemcode.Trim() == "APPF")
                {
                    this.lbPriceAPPF.Text = item.Price.ToString("#,#", System.Globalization.CultureInfo.GetCultureInfo("en"));
                    this.lbNPriceAPPF.Text = item.NetPrice.ToString("#,#", System.Globalization.CultureInfo.GetCultureInfo("en"));
                    this.lbDisAPPF.Text = item.Discount.ToString("#,#", System.Globalization.CultureInfo.GetCultureInfo("en"));
                    Total += item.NetPrice;
                }
         
              
            

              
            }
           
            this.lbTotal.Text = Total.ToString("#,#", System.Globalization.CultureInfo.GetCultureInfo("en"));
          
        }

    }
}
